/**
 * FileName: UserServiceImpl
 * Author:   Administrator
 * Date:     2018/11/16 17:06
 * Description: 后台用户逻辑实现
 * History:
 * <author>          <time>          <version>          <desc>
 * 作者姓名           修改时间           版本号              描述
 */
package com.fortune.rainshinesystem.service.impl;

import com.fortune.rainshinecommon.base.MsgModel;
import com.fortune.rainshinecommon.enums.RespStatusEnum;
import com.fortune.rainshinecommon.model.SysUsers;
import com.fortune.rainshinesystem.mapper.SysUsersMapper;
import com.fortune.rainshinesystem.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;

/**
 * 〈一句话功能简述〉<br> 
 * 〈后台用户逻辑实现〉
 *
 * @author Administrator
 * @create 2018/11/16
 * @since 1.0.0
 */
@Service
public class UserServiceImpl implements UserService {

    @Autowired
    private SysUsersMapper mapper;

    @Override
    public MsgModel<String> addUser(SysUsers user) {
        user.setCreateId("123");
        user.setCreateTime(new Date());
        user.setUpdateId("123");
        user.setUpdateTime(new Date());

        int res = mapper.insert(user);
        return new MsgModel("保存数据成功", RespStatusEnum.SUCCESS);
    }

    @Override
    public MsgModel<?> list() {
        List<SysUsers> users = mapper.selectList();
        return new MsgModel("查询数据成功", RespStatusEnum.SUCCESS,users,10);
    }

}